package cn.yishuai.ai.spring_mcp_server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.beans.factory.annotation.Autowired;
import cn.yishuai.ai.spring_mcp_server.tools.HealthTools;
import cn.yishuai.ai.spring_mcp_server.tools.LlmTools;

@SpringBootApplication
public class SpringMcpServerApplication {

    @Autowired
    private HealthTools healthTools;
    
    @Autowired
    private LlmTools llmTools;

    @EventListener(ContextRefreshedEvent.class)
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("=== 已注册的 MCP Tools ===");
        
        // 检查工具类是否已正确注入
        if (healthTools != null) {
            System.out.println(" - HealthTools 已注入");
        } else {
            System.out.println(" - HealthTools 注入失败");
        }
        
        if (llmTools != null) {
            System.out.println(" - LlmTools 已注入");
        } else {
            System.out.println(" - LlmTools 注入失败");
        }
        
        System.out.println("========================");
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringMcpServerApplication.class, args);
    }
}